package com.haoxin.ai_course.modules.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.haoxin.ai_course.modules.sys.entity.SysUser;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 系统用户
 */
public interface SysUserMapper extends BaseMapper<SysUser> {
	
	/**
	 * 查询用户的所有权限
	 * @param userId  用户ID
	 */
	List<String> queryAllPerms(Long userId);
	
	/**
	 * 查询用户的所有菜单ID
	 */
	List<Long> queryAllMenuId(Long userId);
	
	/**
	 * 修改密码
	 */
	int updatePassword(Map<String, Object> map);

	void saveUserRole(Map<String, Object> map);
	@Insert("insert into sys_user_role" + 
			"			(" + 
			"			`user_id`," + 
			"			`role_id`" + 
			"			)" + 
			"			values" + 
			"			(#{userId}," + 
			"			#{roleId}" + 
			"			)")
	void saveSingleUserRole(@Param("userId") Long userId ,@Param("roleId") Long roleId);
}
